68bc29f0010b7438b06747c176506f65aa7682ca,app/src/main/java/com/farmerbb/taskbar/util/U.java,U,launchMode2,#Context#Intent#boolean#number#,306

Before Change


            top = top + iconSize;

        try {
            context.startActivity(intent, ActivityOptions.makeBasic().setLaunchBounds(new Rect(
                    left,
                    top,
                    right,
                    bottom
            )).toBundle());
        } catch (ActivityNotFoundException | IllegalArgumentException e) { /* Gracefully fail */ }
    }

After Change



    @SuppressWarnings("deprecation")
    @TargetApi(Build.VERSION_CODES.N)
    private static void launchMode2(Context context, Intent intent, boolean padStatusBar, int launchType, long userId) {
        DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
        Display display = dm.getDisplay(Display.DEFAULT_DISPLAY);

        int statusBarHeight = getStatusBarHeight(context);

        String position = getTaskbarPosition(context);
        boolean overridePad = position.equals("top_left") || position.equals("top_right");

        boolean isPortrait = context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
        boolean isLandscape = context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;

        int left = launchType == RIGHT && isLandscape
                ? display.getWidth() / 2
                : 0;

        int top;
        if(launchType == RIGHT && isPortrait) {
            top = (display.getHeight() / 2)
                    + (!padStatusBar && overridePad ? statusBarHeight / 2 : 0)
                    + (!padStatusBar && !overridePad ? statusBarHeight / 2 : 0);
        } else {
            top = padStatusBar || overridePad ? statusBarHeight : 0;
        }

        int right = launchType == LEFT && isLandscape
                ? display.getWidth() / 2
                : display.getWidth();

        int bottom;
        if(launchType == LEFT && isPortrait) {
            bottom = display.getHeight() / 2
                    + (!padStatusBar && overridePad ? statusBarHeight / 2 : 0)
                    - (!padStatusBar && !overridePad ? statusBarHeight / 2 : 0);
        } else {
            bottom = display.getHeight()
                    + ((!padStatusBar && overridePad) || (!padStatusBar && launchType == RIGHT && isPortrait)
                    ? statusBarHeight
                    : 0);
        }

        int iconSize = context.getResources().getDimensionPixelSize(R.dimen.icon_size);

        if(position.contains("vertical_left")) {
            if(launchType != RIGHT || isPortrait) left = left + iconSize;
        } else if(position.contains("vertical_right")) {
            if(launchType != LEFT || isPortrait) right = right - iconSize;
        } else if(position.contains("bottom")) {
            if(isLandscape || (launchType != LEFT && isPortrait))
                bottom = bottom - iconSize;
        } else if(isLandscape || (launchType != RIGHT && isPortrait))
            top = top + iconSize;

        Bundle bundle = ActivityOptions.makeBasic().setLaunchBounds(new Rect(
                left,
                top,
                right,
                bottom
        )).toBundle();

        UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
        if(userId == userManager.getSerialNumberForUser(Process.myUserHandle())) {
            try {
                context.startActivity(intent, bundle);
            } catch (ActivityNotFoundException e) {
                launchAndroidForWork(context, intent.getComponent(), bundle, userId);
            } catch (IllegalArgumentException e) { /* Gracefully fail */ }
        } else
            launchAndroidForWork(context, intent.getComponent(), bundle, userId);
    }

    @SuppressWarnings("deprecation")